﻿using Microsoft.AspNetCore.Identity;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;

namespace SubstrateHelper.Models
{
    public class RecordBase:INotifyPropertyChanged
    {
        
        [Display(Name = "参数值")]
        public String StringValue { get; set; }

        public double? NumeralValue { get; set; }

        public DateTime? DateTimeValue { get; set; }

        [Display(Name = "备注")]                
        public string Remarks { get; set; }

        


        
        public string RecorderId { get; set; }

        

        public bool IsFinished { get; set; }

        public bool IsInspectionFinished { get; set; }


        public bool IsDiscarded { get; set; }
        
        public InspectionState InspectionState { get; set; }


        
        
        public string InspectorId { get; set; }

        ///////////////////////////////////////////////////////


        
        //public IdentityUser Recorder { get; set; }


        
        //public IdentityUser Inspector { get; set; }

        public DateTime UpdateTime { get; set; }

        public event PropertyChangedEventHandler PropertyChanged;

        //public void OnPropertyChanged(string propertyName, object before, object after)
        //{
        //    //Perform property validation
        //    try
        //    {
        //        PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        //    }
        //    catch
        //    {
        //        this.GetType().GetProperty(propertyName).SetValue(this, before);
        //    }            
        //}
    }

    //public enum RecordLifeState
    //{
    //    Normal,//有效
    //    Recoverable,//可恢复
    //    Discarded//已废弃
    //}

    public enum InspectionState
    {
        ToCheck,//待检
        OK,//合格
        NG,//不合格
        NoCheck//不检
    }
}
